package com.sinochem.yunlian.ship.common.enums;

import lombok.Getter;

public enum SensitiveWordsType {
    NORMAL(100,"normal",1,"正常文本"),
    SPAM(101,"spam",1,"含垃圾信息"),
    AD(102,"ad",1,"广告"),
    POLITICS(103,"politics",1,"涉政"),
    TERRORISM(104,"terrorism",1,"暴恐"),
    ABUSE(105,"abuse",1,"辱骂"),
    PORN(106,"porn",1,"色情"),
    FLOOD(107,"flood",1,"灌水"),
    CONTRABAND(108,"contraband",1,"违禁");
    @Getter
    private Integer sysCode;
    @Getter
    private String aliCode;
    @Getter
    private Integer type;
    @Getter
    private String desc;

    SensitiveWordsType(Integer sysCode, String aliCode, Integer type, String desc) {
        this.sysCode = sysCode;
        this.aliCode = aliCode;
        this.type = type;
        this.desc = desc;
    }

    /**
     * 根据AliCode 获取 SensitiveWordsType
     * @param aliCode
     * @return
     */
    public static SensitiveWordsType getTypeByAliCode(String aliCode){
        for (SensitiveWordsType wordsType : values()) {
            if (wordsType.getAliCode().equals(aliCode)) {
                return wordsType;
            }
        }
        return null;
    }
    /**
     * 根据AliCode 获取 SensitiveWordsType
     * @param sysCode
     * @return
     */
    public static SensitiveWordsType getTypeBySysCode(Integer sysCode){
        for (SensitiveWordsType wordsType : values()) {
            if (wordsType.getSysCode()==sysCode) {
                return wordsType;
            }
        }
        return null;
    }



    public static void main(String[] args) {
        System.out.println(SensitiveWordsType.getTypeByAliCode("normal"));

    }
}
